home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb.new / gdb-4.0 / bfd / doc / bfd.p < prev    next >
Encoding:
Text File  |  1991-09-29  |  4.6 KB  |  244 lines

  1. /* @section @code{typedef bfd}
  2.  
  3. A BFD is has type @code{bfd}; objects of this type are the cornerstone
  4. of any application using @code{libbfd}. References though the BFD and
  5. to data in the BFD give the entire BFD functionality.
  6.  
  7. Here is the struct used to define the type @code{bfd}.  This contains
  8. the major data about the file, and contains pointers to the rest of
  9. the data.
  10. */
  11.  
  12. struct _bfd 
  13. {
  14. /*   The filename the application opened the BFD with.
  15. */
  16.  
  17.   CONST char *filename;                
  18.  
  19. /*
  20. A pointer to the target jump table.
  21. */
  22.  
  23.   struct bfd_target *xvec;
  24.  
  25. /*
  26.  
  27. To avoid dragging too many header files into every file that
  28. includes @file{bfd.h}, IOSTREAM has been declared as a "char *", and MTIME
  29. as a "long".  Their correct types, to which they are cast when used,
  30. are "FILE *" and "time_t".  
  31.  
  32. The iostream is the result of an fopen on the filename.
  33. */
  34.  
  35.   char *iostream;
  36.  
  37. /*
  38. Is the file being cached @xref{File Caching}.
  39. */
  40.  
  41.   boolean cacheable;
  42.  
  43. /*
  44. Marks whether there was a default target specified when the BFD was
  45. opened. This is used to select what matching algorithm to use to chose
  46. the back end.
  47. */
  48.  
  49.   boolean target_defaulted;
  50.  
  51. /*
  52. The caching routines use these to maintain a least-recently-used list of
  53. BFDs (@pxref{File Caching}).
  54. */
  55.  
  56.   struct _bfd *lru_prev, *lru_next;
  57.  
  58. /*
  59. When a file is closed by the caching routines, BFD retains state
  60. information on the file here:
  61. */
  62.  
  63.   file_ptr where;              
  64.  
  65. /*
  66. and here:
  67. */
  68.  
  69.   boolean opened_once;
  70.  
  71. /*
  72. */
  73.   boolean mtime_set;
  74. /* File modified time 
  75. */
  76.  
  77.   long mtime;          
  78.  
  79. /*
  80. Reserved for an unimplemented file locking extension.
  81. */
  82.  
  83. int ifd;
  84.  
  85. /*
  86. The format which belongs to the BFD.
  87. */
  88.  
  89.   bfd_format format;
  90.  
  91. /*
  92. The direction the BFD was opened with
  93. */
  94.  
  95.   enum bfd_direction {no_direction = 0,
  96.                        read_direction = 1,
  97.                        write_direction = 2,
  98.                        both_direction = 3} direction;
  99.  
  100. /*
  101. Format_specific flags
  102. */
  103.  
  104.   flagword flags;              
  105.  
  106. /*
  107. Currently my_archive is tested before adding origin to anything. I
  108. believe that this can become always an add of origin, with origin set
  109. to 0 for non archive files.  
  110. */
  111.  
  112.   file_ptr origin;             
  113.  
  114. /*
  115. Remember when output has begun, to stop strange things happening.
  116. */
  117.  
  118.   boolean output_has_begun;
  119.  
  120. /*
  121. Pointer to linked list of sections
  122. */
  123.  
  124.   struct sec  *sections;
  125.  
  126. /*
  127. The number of sections 
  128. */
  129.  
  130.   unsigned int section_count;
  131.  
  132. /*
  133. Stuff only useful for object files:
  134. The start address.
  135. */
  136.  
  137.   bfd_vma start_address;
  138. /* Used for input and output
  139. */
  140.  
  141.   unsigned int symcount;
  142. /* Symbol table for output BFD
  143. */
  144.  
  145.   struct symbol_cache_entry  **outsymbols;             
  146.  
  147. /*
  148. Architecture of object machine, eg m68k 
  149. */
  150.  
  151.   enum bfd_architecture obj_arch;
  152.  
  153. /*
  154. Particular machine within arch, e.g. 68010
  155. */
  156.  
  157.   unsigned long obj_machine;
  158.  
  159. /*
  160. Stuff only useful for archives:
  161. */
  162.  
  163.   PTR arelt_data;              
  164.   struct _bfd *my_archive;     
  165.   struct _bfd *next;           
  166.   struct _bfd *archive_head;   
  167.   boolean has_armap;           
  168.  
  169. /*
  170. Used by the back end to hold private data.
  171. */
  172.  
  173.   PTR tdata;
  174.  
  175. /*
  176. Used by the application to hold private data
  177. */
  178.  
  179.   PTR usrdata;
  180.  
  181. /*
  182. Where all the allocated stuff under this BFD goes (@pxref{Memory Usage}).
  183. */
  184.  
  185.   struct obstack memory;
  186. };
  187.  
  188. /*
  189.  
  190.  bfd_set_start_address
  191.  
  192. Marks the entry point of an output BFD. Returns @code{true} on
  193. success, @code{false} otherwise.
  194. */
  195.  
  196.  PROTO(boolean, bfd_set_start_address,(bfd *, bfd_vma));
  197.  
  198. /*
  199.  
  200.   bfd_get_mtime
  201.  
  202. Return cached file modification time (e.g. as read from archive header
  203. for archive members, or from file system if we have been called
  204. before); else determine modify time, cache it, and return it.  
  205. */
  206.  
  207.  PROTO(long, bfd_get_mtime, (bfd *));
  208.  
  209. /*
  210.  
  211.  stuff
  212. */
  213.  
  214.  
  215. #define bfd_sizeof_headers(abfd, reloc) \
  216.      BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
  217.  
  218. #define bfd_find_nearest_line(abfd, section, symbols, offset, filename_ptr, func, line_ptr) \
  219.      BFD_SEND (abfd, _bfd_find_nearest_line,  (abfd, section, symbols, offset, filename_ptr, func, line_ptr))
  220.  
  221. #define bfd_debug_info_start(abfd) \
  222.         BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
  223.  
  224. #define bfd_debug_info_end(abfd) \
  225.         BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
  226.  
  227. #define bfd_debug_info_accumulate(abfd, section) \
  228.         BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
  229.  
  230. #define bfd_stat_arch_elt(abfd, stat) \
  231.         BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
  232.  
  233. #define bfd_coff_swap_aux_in(a,e,t,c,i) \
  234.         BFD_SEND (a, _bfd_coff_swap_aux_in, (a,e,t,c,i))
  235.  
  236. #define bfd_coff_swap_sym_in(a,e,i) \
  237.         BFD_SEND (a, _bfd_coff_swap_sym_in, (a,e,i))
  238.  
  239. #define bfd_coff_swap_lineno_in(a,e,i) \
  240.         BFD_SEND ( a, _bfd_coff_swap_lineno_in, (a,e,i))
  241.  
  242. /*
  243. */
  244.